<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.ignou.mca.beans.UserVO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.ignou.mca.beans.QuestionsBean"%>
<%@page import="java.util.StringTokenizer"%>
<%@page import="java.util.Iterator"%><html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="theme/style.css"
	media="screen" />
<title>Displaying question</title>
</head>
<body onload="userfocus()">
	<div id="MainWrapper">
		<div id="MainContent">

		<center><h2>Question</h2></center>
		<%
			UserVO uvo = (UserVO) session.getAttribute("UserVO");
			if(uvo==null)
			{
		%>
			No details available
		<%
			}
			else
			{
				String s = request.getParameter("question");
				int qid = 0;
				if(s!=null)
				{
					qid = Integer.parseInt(s);					
				}
				ArrayList<QuestionsBean> qb = (ArrayList<QuestionsBean>) session.getAttribute("Questions");
				for(int i=0; i<qb.size();i++)
				{
					QuestionsBean qbb = (QuestionsBean) qb.get(i);
					if(qbb.getQuestionId()==qid)
					{
						%>
							
								<table width="450">
									<tr><td>Question Id: </td><td><b><%=qbb.getQuestionId() %></b></td></tr>
									<tr><td>Question: </td><td><b><%=qbb.getQuestion() %></b></td></tr>
									<tr><td>Options: </td><tr>
										<%	
											ArrayList<String> st = qbb.getOptions();
											Iterator itr = st.iterator();
											int ii=1;
											while(itr.hasNext()) 
											{
												out.println("<tr><td></td><td>"+ii + ". " + itr.next()+"</td></tr>");
												ii++;
											}
										%>
									<tr><td>Correct Answer: </td><td><b><%=qbb.getCorrectAnswer() %></b></td></tr>
								</table>

						<%
					}
				}
			}
		%>
		</div>
	</div>
</body>
</html>